home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / MoviesFormat.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  15KB  |  607 lines

  1. /*
  2.      File:        MoviesFormat.h
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.1
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __MOVIESFORMAT__
  19. #define __MOVIESFORMAT__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __WINDOWS__
  25. #include <Windows.h>
  26. #endif
  27. #ifndef __IMAGECOMPRESSION__
  28. #include <ImageCompression.h>
  29. #endif
  30. #ifndef __MOVIES__
  31. #include <Movies.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT_SUPPORTED
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  47.  
  48. enum {
  49.     kMovieVersion                = 0                                /* version number of the format here described */
  50. };
  51.  
  52. /*
  53. ***************************************
  54. *
  55. *   General Types -
  56. *        These types are used in more than one of the
  57. *        directory types.
  58. *
  59. ***************************************
  60. */
  61. /* MoviesUserData is the type used for user data in movie and track directories */
  62. struct MoviesUserData {
  63.     long                             size;                        /* size of this user data */
  64.     long                             udType;                        /* type of user data */
  65.     char                             data[1];                    /* the user data */
  66. };
  67. typedef struct MoviesUserData MoviesUserData;
  68.  
  69. struct UserDataAtom {
  70.     long                             size;
  71.     long                             atomType;
  72.     MoviesUserData                     userData[1];
  73. };
  74. typedef struct UserDataAtom UserDataAtom;
  75.  
  76. /*
  77. ***************************************
  78. *
  79. *   MediaDirectory information -
  80. *        The MediaDirectory is tightly coupled to the data.
  81. *
  82. ***************************************
  83. */
  84. struct SampleDescriptionAtom {
  85.     long                             size;
  86.     long                             atomType;                    /* = 'stsd' */
  87.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  88.     long                             numEntries;
  89.     SampleDescription                 sampleDescTable[1];
  90. };
  91. typedef struct SampleDescriptionAtom SampleDescriptionAtom;
  92.  
  93. /* TimeToSampleNum maps physical sample time to physical sample number. */
  94. struct TimeToSampleNum {
  95.     long                             sampleCount;
  96.     TimeValue                         sampleDuration;
  97. };
  98. typedef struct TimeToSampleNum TimeToSampleNum;
  99.  
  100. struct TimeToSampleNumAtom {
  101.     long                             size;
  102.     long                             atomType;                    /* = 'stts' */
  103.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  104.     long                             numEntries;
  105.     TimeToSampleNum                 timeToSampleNumTable[1];
  106. };
  107. typedef struct TimeToSampleNumAtom TimeToSampleNumAtom;
  108.  
  109. /* SyncSamples is a list of the physical samples which are self contained. */
  110. struct SyncSampleAtom {
  111.     long                             size;
  112.     long                             atomType;                    /* = 'stss' */
  113.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  114.     long                             numEntries;
  115.     long                             syncSampleTable[1];
  116. };
  117. typedef struct SyncSampleAtom SyncSampleAtom;
  118.  
  119. /* SampleToChunk maps physical sample number to chunk number. */
  120. /* same as SampleToChunk, but redundant first sample is removed */
  121. struct SampleToChunk {
  122.     long                             firstChunk;
  123.     long                             samplesPerChunk;
  124.     long                             sampleDescriptionID;
  125. };
  126. typedef struct SampleToChunk SampleToChunk;
  127.  
  128. struct SampleToChunkAtom {
  129.     long                             size;
  130.     long                             atomType;                    /* = 'stsc' */
  131.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  132.     long                             numEntries;
  133.     SampleToChunk                     sampleToChunkTable[1];
  134. };
  135. typedef struct SampleToChunkAtom SampleToChunkAtom;
  136.  
  137. struct ChunkOffsetAtom {
  138.     long                             size;
  139.     long                             atomType;                    /* = 'stco' */
  140.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  141.     long                             numEntries;
  142.     long                             chunkOffsetTable[1];
  143. };
  144. typedef struct ChunkOffsetAtom ChunkOffsetAtom;
  145.  
  146. struct SampleSizeAtom {
  147.     long                             size;
  148.     long                             atomType;                    /* = 'stsz' */
  149.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  150.     long                             sampleSize;
  151.     long                             numEntries;
  152.     long                             sampleSizeTable[1];
  153. };
  154. typedef struct SampleSizeAtom SampleSizeAtom;
  155.  
  156. struct ShadowSync {
  157.     long                             fdSampleNum;
  158.     long                             syncSampleNum;
  159. };
  160. typedef struct ShadowSync ShadowSync;
  161.  
  162. struct ShadowSyncAtom {
  163.     long                             size;
  164.     long                             atomType;                    /* = 'stsz' */
  165.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  166.     long                             numEntries;
  167.     ShadowSync                         shadowSyncTable[1];
  168. };
  169. typedef struct ShadowSyncAtom ShadowSyncAtom;
  170.  
  171. struct SampleTableAtom {
  172.     long                             size;
  173.     long                             atomType;                    /* = 'stbl' */
  174.  
  175.     SampleDescriptionAtom             sampleDescription;
  176.     TimeToSampleNumAtom             timeToSampleNum;
  177.     SampleToChunkAtom                 sampleToChunk;
  178.     SyncSampleAtom                     syncSample;
  179.     SampleSizeAtom                     sampleSize;
  180.     ChunkOffsetAtom                 chunkOffset;
  181.     ShadowSyncAtom                     shadowSync;
  182. };
  183. typedef struct SampleTableAtom SampleTableAtom;
  184.  
  185. struct PublicHandlerInfo {
  186.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  187.  
  188.     long                             componentType;
  189.     long                             componentSubType;
  190.     long                             componentManufacturer;
  191.     long                             componentFlags;
  192.     long                             componentFlagsMask;
  193.     char                             componentName[1];
  194. };
  195. typedef struct PublicHandlerInfo PublicHandlerInfo;
  196.  
  197. struct HandlerAtom {
  198.     long                             size;
  199.     long                             atomType;                    /* = 'hdlr' */
  200.  
  201.     PublicHandlerInfo                 hInfo;
  202. };
  203. typedef struct HandlerAtom HandlerAtom;
  204.  
  205. /* a data reference is a private structure */
  206. typedef long DataRefAtom;
  207. struct DataInfoAtom {
  208.     long                             size;
  209.     long                             atomType;                    /* = 'dinf' */
  210.  
  211.     DataRefAtom                     dataRef;
  212. };
  213. typedef struct DataInfoAtom DataInfoAtom;
  214.  
  215. struct RgnAtom {
  216.     long                             size;
  217.     long                             atomType;
  218.  
  219.     short                             rgnSize;
  220.     Rect                             rgnBBox;
  221.     char                             data[1];
  222. };
  223. typedef struct RgnAtom RgnAtom;
  224.  
  225. struct MatteCompressedAtom {
  226.     long                             size;
  227.     long                             atomType;
  228.  
  229.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  230.  
  231.     ImageDescription                 matteImageDescription;
  232.  
  233.     char                             matteData[1];
  234. };
  235. typedef struct MatteCompressedAtom MatteCompressedAtom;
  236.  
  237. struct MatteAtom {
  238.     long                             size;
  239.     long                             atomType;
  240.  
  241.     MatteCompressedAtom             aCompressedMatte;
  242. };
  243. typedef struct MatteAtom MatteAtom;
  244.  
  245. struct ClippingAtom {
  246.     long                             size;
  247.     long                             atomType;
  248.  
  249.     RgnAtom                         aRgnClip;
  250. };
  251. typedef struct ClippingAtom ClippingAtom;
  252.  
  253. /*
  254. **********************
  255. * Media Info Example Structures
  256. **********************
  257. */
  258. struct VideoMediaInfoHeader {
  259.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  260.  
  261.     short                             graphicsMode;                /* for QD - transfer mode */
  262.     short                             opColorRed;                    /* opcolor for transfer mode */
  263.     short                             opColorGreen;
  264.     short                             opColorBlue;
  265. };
  266. typedef struct VideoMediaInfoHeader VideoMediaInfoHeader;
  267.  
  268. struct VideoMediaInfoHeaderAtom {
  269.     long                             size;                        /* size of Media info */
  270.     long                             atomType;                    /* = 'vmhd' */
  271.     VideoMediaInfoHeader             vmiHeader;
  272. };
  273. typedef struct VideoMediaInfoHeaderAtom VideoMediaInfoHeaderAtom;
  274.  
  275. struct VideoMediaInfo {
  276.     long                             size;                        /* size of Media info */
  277.     long                             atomType;                    /* = 'minf' */
  278.  
  279.     VideoMediaInfoHeaderAtom         header;
  280.  
  281.     HandlerAtom                     dataHandler;
  282.  
  283.     DataInfoAtom                     dataInfo;
  284.  
  285.     SampleTableAtom                 sampleTable;
  286. };
  287. typedef struct VideoMediaInfo VideoMediaInfo;
  288.  
  289. struct SoundMediaInfoHeader {
  290.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  291.  
  292.     short                             balance;
  293.     short                             rsrvd;
  294. };
  295. typedef struct SoundMediaInfoHeader SoundMediaInfoHeader;
  296.  
  297. struct SoundMediaInfoHeaderAtom {
  298.     long                             size;                        /* size of Media info */
  299.     long                             atomType;                    /* = 'vmhd' */
  300.  
  301.     SoundMediaInfoHeader             smiHeader;
  302. };
  303. typedef struct SoundMediaInfoHeaderAtom SoundMediaInfoHeaderAtom;
  304.  
  305. struct SoundMediaInfo {
  306.     long                             size;                        /* size of Media info */
  307.     long                             atomType;                    /* = 'minf' */
  308.  
  309.     SoundMediaInfoHeaderAtom         header;
  310.  
  311.     HandlerAtom                     dataHandler;
  312.  
  313.     DataRefAtom                     dataReference;
  314.  
  315.     SampleTableAtom                 sampleTable;
  316. };
  317. typedef struct SoundMediaInfo SoundMediaInfo;
  318.  
  319. /* whatever data the media handler needs goes after the atomType */
  320. struct MediaInfo {
  321.     long                             size;
  322.     long                             atomType;
  323. };
  324. typedef struct MediaInfo MediaInfo;
  325.  
  326. /*
  327. **********************
  328. * Media Directory Structures
  329. **********************
  330. */
  331. struct MediaHeader {
  332.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  333.  
  334.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  335.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  336.  
  337.     TimeValue                         timeScale;                    /* start time for Media (Media time) */
  338.     TimeValue                         duration;                    /* length of Media (Media time) */
  339.  
  340.     short                             language;
  341.     short                             quality;
  342. };
  343. typedef struct MediaHeader MediaHeader;
  344.  
  345. struct MediaHeaderAtom {
  346.     long                             size;
  347.     long                             atomType;
  348.  
  349.     MediaHeader                     header;
  350. };
  351. typedef struct MediaHeaderAtom MediaHeaderAtom;
  352.  
  353. struct MediaDirectory {
  354.     long                             size;
  355.     long                             atomType;                    /* = 'mdia' */
  356.  
  357.     MediaHeaderAtom                 mediaHeader;                /* standard Media information */
  358.  
  359.     HandlerAtom                     mediaHandler;
  360.  
  361.     MediaInfo                         mediaInfo;
  362. };
  363. typedef struct MediaDirectory MediaDirectory;
  364.  
  365. /*
  366. **********************
  367. * Track Structures
  368. **********************
  369. */
  370.  
  371. enum {
  372.     TrackEnable                    = 1 << 0,
  373.     TrackInMovie                = 1 << 1,
  374.     TrackInPreview                = 1 << 2,
  375.     TrackInPoster                = 1 << 3
  376. };
  377.  
  378. struct TrackHeader {
  379.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  380.  
  381.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  382.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  383.  
  384.     long                             trackID;
  385.  
  386.     long                             reserved1;
  387.  
  388.     TimeValue                         duration;                    /* length of track (track time) */
  389.  
  390.     long                             reserved2;
  391.     long                             reserved3;
  392.  
  393.     short                             layer;
  394.     short                             alternateGroup;
  395.  
  396.     short                             volume;
  397.     short                             reserved4;
  398.  
  399.     MatrixRecord                     matrix;
  400.     Fixed                             trackWidth;
  401.     Fixed                             trackHeight;
  402. };
  403. typedef struct TrackHeader TrackHeader;
  404.  
  405. struct TrackHeaderAtom {
  406.     long                             size;                        /* size of track header */
  407.     long                             atomType;                    /* = 'tkhd' */
  408.  
  409.     TrackHeader                     header;
  410. };
  411. typedef struct TrackHeaderAtom TrackHeaderAtom;
  412.  
  413. struct EditListType {
  414.     TimeValue                         trackDuration;
  415.     TimeValue                         mediaTime;
  416.     Fixed                             mediaRate;
  417. };
  418. typedef struct EditListType EditListType;
  419.  
  420. struct EditListAtom {
  421.     long                             size;
  422.     long                             atomType;                    /* = elst */
  423.  
  424.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  425.  
  426.     long                             numEntries;
  427.     EditListType                     editListTable[1];
  428. };
  429. typedef struct EditListAtom EditListAtom;
  430.  
  431. struct EditsAtom {
  432.     long                             size;
  433.     long                             atomType;                    /* = edts */
  434.  
  435.     EditListAtom                     editList;
  436. };
  437. typedef struct EditsAtom EditsAtom;
  438.  
  439. struct TrackLoadSettings {
  440.     TimeValue                         preloadStartTime;
  441.     TimeValue                         preloadDuration;
  442.     long                             preloadFlags;
  443.     long                             defaultHints;
  444. };
  445. typedef struct TrackLoadSettings TrackLoadSettings;
  446.  
  447. struct TrackLoadSettingsAtom {
  448.     long                             size;
  449.     long                             atomType;                    /* = load */
  450.  
  451.     TrackLoadSettings                 settings;
  452. };
  453. typedef struct TrackLoadSettingsAtom TrackLoadSettingsAtom;
  454.  
  455. struct TrackDirectory {
  456.     long                             size;
  457.     long                             atomType;                    /* = 'trak' */
  458.  
  459.     TrackHeaderAtom                 trackHeader;                /* standard track information */
  460.  
  461.     ClippingAtom                     trackClip;
  462.  
  463.     EditsAtom                         edits;
  464.  
  465.     MediaDirectory                     media;
  466.  
  467.     UserDataAtom                     userData;                    /* space for extending with new data types */
  468. };
  469. typedef struct TrackDirectory TrackDirectory;
  470.  
  471. /*
  472. ***************************************
  473. *
  474. *   MovieDirectory -
  475. *        The MovieDirectory is the top level structure which
  476. *        holds the TrackInstance describing where the
  477. *        TrackDirectories are.
  478. *
  479. ***************************************
  480. */
  481. struct MovieHeader {
  482.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  483.  
  484.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  485.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  486.  
  487.     TimeValue                         timeScale;                    /* Time specifications */
  488.     TimeValue                         duration;
  489.     Fixed                             preferredRate;                /* rate at which to play this movie */
  490.  
  491.     short                             preferredVolume;            /* volume to play movie at */
  492.     short                             reserved1;
  493.  
  494.     long                             preferredLong1;
  495.     long                             preferredLong2;
  496.  
  497.     MatrixRecord                     matrix;
  498.  
  499.     TimeValue                         previewTime;                /* time in track the proxy begins (track time) */
  500.     TimeValue                         previewDuration;            /* how long the proxy lasts (track time) */
  501.  
  502.     TimeValue                         posterTime;                    /* time in track the proxy begins (track time) */
  503.  
  504.     TimeValue                         selectionTime;                /* time in track the proxy begins (track time) */
  505.     TimeValue                         selectionDuration;            /* time in track the proxy begins (track time) */
  506.     TimeValue                         currentTime;                /* time in track the proxy begins (track time) */
  507.  
  508.     long                             nextTrackID;                /* next value to use for a TrackID */
  509. };
  510. typedef struct MovieHeader MovieHeader;
  511.  
  512. struct MovieHeaderAtom {
  513.     long                             size;
  514.     long                             atomType;                    /* = 'mvhd' */
  515.  
  516.     MovieHeader                     header;
  517. };
  518. typedef struct MovieHeaderAtom MovieHeaderAtom;
  519.  
  520. struct MovieDirectory {
  521.     long                             size;
  522.     long                             atomType;                    /* = 'moov' */
  523.  
  524.     MovieHeaderAtom                 header;
  525.  
  526.     ClippingAtom                     movieClip;
  527.  
  528.                                                                 /* Track Directories */
  529.     TrackDirectory                     track[1];
  530.  
  531.                                                                 /* User data for Movie */
  532.     UserDataAtom                     userData;                    /* space for user extensions */
  533. };
  534. typedef struct MovieDirectory MovieDirectory;
  535.  
  536. /*
  537. ***************************************
  538. ***************************************
  539. */
  540. /* Movie formats and tags */
  541.  
  542. enum {
  543.                                                                 /* some system defined format IDs */
  544.     MOVIE_TYPE                    = 'moov',
  545.     TRACK_TYPE                    = 'trak',
  546.     MEDIA_TYPE                    = 'mdia',
  547.     VIDEO_TYPE                    = 'vide',
  548.     SOUND_TYPE                    = 'soun'
  549. };
  550.  
  551. /* atom id's */
  552.  
  553. enum {
  554.     MovieAID                    = 'moov',
  555.     MovieHeaderAID                = 'mvhd',
  556.     ClipAID                        = 'clip',
  557.     RgnClipAID                    = 'crgn',
  558.     MatteAID                    = 'matt',
  559.     MatteCompAID                = 'kmat',
  560.     TrackAID                    = 'trak',
  561.     UserDataAID                    = 'udta',
  562.     TrackHeaderAID                = 'tkhd',
  563.     EditsAID                    = 'edts',
  564.     EditListAID                    = 'elst',
  565.     MediaAID                    = 'mdia',
  566.     MediaHeaderAID                = 'mdhd',
  567.     MediaInfoAID                = 'minf',
  568.     VideoMediaInfoHeaderAID        = 'vmhd',
  569.     SoundMediaInfoHeaderAID        = 'smhd',
  570.     GenericMediaInfoHeaderAID    = 'gmhd',
  571.     GenericMediaInfoAID            = 'gmin',
  572.     DataInfoAID                    = 'dinf',
  573.     DataRefAID                    = 'dref',
  574.     SampleTableAID                = 'stbl',
  575.     STSampleDescAID                = 'stsd',
  576.     STTimeToSampAID                = 'stts',
  577.     STSyncSampleAID                = 'stss',
  578.     STSampleToChunkAID            = 'stsc',
  579.     STShadowSyncAID                = 'stsh',
  580.     HandlerAID                    = 'hdlr',
  581.     STSampleSizeAID                = 'stsz',
  582.     STChunkOffsetAID            = 'stco',
  583.     DataRefContainerAID            = 'drfc',
  584.     TrackReferenceAID            = 'tref',
  585.     ColorTableAID                = 'ctab',
  586.     LoadSettingsAID                = 'load',
  587.     PropertyAtomAID                = 'code',
  588.     InputMapAID                    = 'imap'
  589. };
  590.  
  591. #endif
  592.  
  593. #if PRAGMA_ALIGN_SUPPORTED
  594. #pragma options align=reset
  595. #endif
  596.  
  597. #if PRAGMA_IMPORT_SUPPORTED
  598. #pragma import off
  599. #endif
  600.  
  601. #ifdef __cplusplus
  602. }
  603. #endif
  604.  
  605. #endif /* __MOVIESFORMAT__ */
  606.  
  607.